home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / laptop-mode-tools / modules / syslog-conf < prev    next >
Encoding:
Text File  |  2012-05-20  |  1.9 KB  |  54 lines

  1. #! /bin/sh
  2. #
  3. # Laptop mode tools module: syslog.conf switching functionality (DEPRECATED)
  4. #
  5. #
  6. # This module implements the old syslog.conf functionality -- deprecated but
  7. # still supported for backward compatibility.
  8.  
  9. if [ x$CONTROL_SYSLOG_CONF = x1 ] ; then
  10.     log "VERBOSE" "Adjusting syslog configuration."
  11.     if [ "`readlink -f $SYSLOG_CONF`" != "$SYSLOG_CONF" ] ; then
  12.         log "MSG" "$SYSLOG_CONF is a symlink."
  13.         if [ ! -f "$SYSLOG_CONF.no-lm" ] ; then
  14.             log "VERBOSE" "But there is no $SYSLOG_CONF.no-lm. This must have been done by an earlier"
  15.             log "VERBOSE" "version of laptop-mode-tools."
  16.             log "VERBOSE" "Creating it now from $NOLM_AC_SYSLOG_CONF."
  17.             cp "$NOLM_AC_SYSLOG_CONF" "$SYSLOG_CONF.no-lm"
  18.         fi
  19.     else
  20.         log "VERBOSE" "$SYSLOG_CONF is not a symlink."
  21.         if [ "$STATE" = "enabled" ] ; then
  22.             log "VERBOSE" "Saving it to $SYSLOG_CONF.no-lm."
  23.             cp --backup=numbered "$SYSLOG_CONF" "$SYSLOG_CONF.no-lm"
  24.         fi
  25.     fi
  26.  
  27.     if [ "$STATE" != "enabled" ] ; then
  28.         log "VERBOSE" "Laptop mode is not enabled. Restoring $SYSLOG_CONF."
  29.         if [ -f "$SYSLOG_CONF.no-lm" ] ; then
  30.             mv "$SYSLOG_CONF.no-lm" "$SYSLOG_CONF"
  31.         elif [ "`readlink -f $SYSLOG_CONF`" != "$SYSLOG_CONF" ] ; then
  32.             echo "ERROR: $SYSLOG_CONF is a symlink but $SYSLOG_CONF.no-lm is not present."
  33.         fi
  34.     elif [ $ON_AC -eq 1 ] ; then
  35.         if [ "$ACTIVATE" -eq 1 ] ; then
  36.             log "VERBOSE" "Setting syslog config to $LM_AC_SYSLOG_CONF."
  37.             ln -fs "$LM_AC_SYSLOG_CONF" "$SYSLOG_CONF"
  38.         else
  39.             log "VERBOSE" "Setting syslog config to $NOLM_AC_SYSLOG_CONF."
  40.             ln -fs "$NOLM_AC_SYSLOG_CONF" "$SYSLOG_CONF"
  41.         fi
  42.     else
  43.         log "VERBOSE" "Setting syslog config to $BATT_SYSLOG_CONF."
  44.         ln -fs "$BATT_SYSLOG_CONF" "$SYSLOG_CONF"
  45.     fi
  46.     # Notify syslogd of configuration change.
  47.     if [ "$SYSLOG_CONF_SIGNAL_PROGRAM" != "" ] ; then
  48.         log "VERBOSE" "Sending SIGHUP to all $SYSLOG_CONF_SIGNAL_PROGRAM processes."
  49.         killall -q -HUP $SYSLOG_CONF_SIGNAL_PROGRAM
  50.     fi
  51. fi
  52.  
  53.